<template>
  <div class="main_box">
    <div class="detail_wrap">
      <div class="tit">
        <h2>基础信息</h2>
        <el-button plain size="small" type="success" icon="fa fa-mail-forward" @click="returnList"> 返 回</el-button>
      </div>
      <div class="con">
        <ul>
<!--          <li class="photo">
            <label class="label">头像:</label>
            <span><img :src=institutionData.institutionImageUrl/></span>
          </li>-->
          <li>
            <label class="label">医检名称:</label>
            <span>{{ institutionData.institutionName }}</span>
          </li>
          <li>
            <label class="label">医检类型:</label>
            <span>{{ formatInstitutionType(institutionData.institutionType) }}</span>
          </li>
          <li>
            <label class="label">医检简称:</label>
            <span>{{ institutionData.institutionShortName }}</span>
          </li>
          <!--<li>
            <label class="label">成立时间</label>
            <span>{{institutionData.institutionEstablishDate}}</span>
          </li>-->
          <li>
            <label class="label">所在区域:</label>
            <span><em>{{ institutionData.provinceName }}{{ institutionData.cityName }}{{ institutionData.areaName }}</em></span>
          </li>
          <!--<li>
            <label class="label">所在商圈</label>
            <span>{{institutionData.tradeAreaName}}</span>
          </li>-->
          <li>
            <label class="label">详细地址:</label>
            <span>{{ institutionData.institutionAddress }}</span>
          </li>

          <!--<li>
            <label class="label">营业执照名称</label>
            <span>{{institutionData.businessLicenceName}}</span>
          </li>-->
          <li>
            <label class="label">联系人姓名:</label>
            <span>{{ institutionData.contactsName }}</span>
          </li>
          <li>
            <label class="label">联系人职称:</label>
            <span>{{ institutionData.contactsTitle }}</span>
          </li>
          <li>
            <label class="label">联系人手机号码:</label>
            <span>{{ institutionData.contactsTel }}</span>
          </li>
          <li>
            <label class="label">联系人邮箱地址:</label>
            <span>{{ institutionData.contactsEmail }}</span>
          </li>
          <li>
            <label class="label">医检介绍:</label>
            <span>{{ institutionData.institutionIntroduce }}</span>
          </li>
          <li v-if="institutionData.printerCode">
            <label class="label">关联打印机编号</label>
            <span>{{ institutionData.printerCode }}</span>
          </li>

          <li>
            <label class="label">开发业务员:</label>
            <span>{{ institutionData.developUserName }}</span>
          </li>
          <li>
            <label class="label">维护业务员:</label>
            <span>{{ institutionData.keepUserName }}</span>
          </li>
          <li>
            <label class="label">合作折扣:</label>
            <span>{{ institutionData.discount }}%</span>
          </li>
          <li>
            <label class="label">合作协议:</label>
            <el-image :src="contractImageList[0]" :preview-src-list="contractImageList">
            </el-image>
          </li>
          <!--<li>
            <label class="label">营业执照图片</label>
            <span><img v-show="institutionData.businessLicenceUrl" :src=institutionData.businessLicenceUrl /></span>
          </li>
          <li>
            <label class="label">营业执照时间</label>
            <span>{{institutionData.businessLicenceValidity}}</span>
          </li>
          <li>
            <label class="label">机构执业许可证图片</label>
            <span><img v-show="institutionData.medicalLicenceUrl" :src=institutionData.medicalLicenceUrl /></span>
          </li>
          <li>
            <label class="label">机构执业许可证时间</label>
            <span>{{institutionData.medicalLicenceValidity}}</span>
          </li>
          <li>
            <label class="label">广告审查证明图片</label>
            <span><img v-show="institutionData.medicalAdUrl" :src=institutionData.medicalAdUrl /></span>
          </li>
          <li>
            <label class="label">广告审查证明时间</label>
            <span>{{institutionData.medicalAdValidity}}</span>
          </li>-->

        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import InstitutionApi from "@/api/institution/institution";
import Map from "@/components/Map";

export default {
  data() {
    return {
      institutionData: "",
      contractImageList: []
    }
  },
  components: {
    Map
  },
  beforeRouteLeave(to, from, next) {
    to.meta.keepAlive = true
    next()
  },
  methods: {
    getData() {
      // console.log({institutionId:this.$route.query.id});
      InstitutionApi.getInstitution({institutionId: this.$route.query.id})
        .then(res => {
          // console.log(res.data);
          this.institutionData = res.data;
          if (res.data.contractImages) {
            this.contractImageList = res.data.contractImages.split(',');
          }
        })
    },
    formatDate(value) {
      return this.$Utils.formatDate(value, 'yyyy-MM-dd hh:mm:ss')
    },
    formatInstitutionType(value) { //1.医检机构 2.三甲机构
      if (value === 1) {
        return "医检机构";
      } else if (value === 2) {
        return "三甲机构";
      }
    },
    returnList() {
      this.$store.dispatch('delView', this.$route);
      this.$router.push({path: '/institu/instituManagement'});
    }
  },
  mounted() {
    this.getData();
  }
}
</script>
<style lang="scss" src="@/assets/css/views/Detail.scss" scope>
</style>
